package edu.pitt.cs3530.scripts;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Map.Entry;

public class GetWattageGraph {
	public static void main(String args[]) {
		File directory = new File(args[0]);
		File[] fileArray = directory.listFiles();
		Map<Integer, List<File>> fileMap = new HashMap<Integer, List<File>>();
		List<File> list = null;
		int lastTest = 0;
		for (int i = 0; i < fileArray.length; i++) {
			StringTokenizer tok = new StringTokenizer(fileArray[i]
					.getName(), "-");
			tok.nextToken();
			int test = Integer.parseInt(tok.nextToken());
			int run = Integer.parseInt(tok.nextToken());
			if (test != lastTest) {
				lastTest = test;
				list = new ArrayList<File>();
				fileMap.put(test, list);
			}
			list.add(new File(fileArray[i].getAbsolutePath()));
			System.out.println("File found: " + fileArray[i].getAbsolutePath());
		}
		for (Entry<Integer, List<File>> entry : fileMap.entrySet()) {
			
		}
	}
}
